package com.dstz.crm.core.manager.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.dstz.base.manager.impl.BaseManager;
import com.dstz.crm.core.dao.CustomerRelationDao;
import com.dstz.crm.core.manager.CustomerRelationManager;
import com.dstz.crm.core.model.CustomerRelation;
/**
 * 案例 Manager处理实现类
 * @author aschs
 * @email aschs@qq.com
 * @time 2018-08-24 18:06:04
 */
@Service("customerRelationManager")
public class CustomerRelationManagerImpl extends BaseManager<String, CustomerRelation> implements CustomerRelationManager{
	@Resource
	CustomerRelationDao customerRelationDao;

	@Override
	public void removeByCustomerId(String customerId) {
		customerRelationDao.removeByCustomerId(customerId);
	}
	
	@Override
	public void removeByContractId(String contractId) {
		customerRelationDao.removeByContractId(contractId);
		
	}

	@Override
	public List<CustomerRelation> getCustomerRelation(String customerId, String relationType) {
		return customerRelationDao.getCustomerRelation( customerId,  relationType);
	}

	@Override
	public List<CustomerRelation> getContractRelation(String contractId, String relationType) {
		return customerRelationDao.getContractRelation( contractId,  relationType);
	}


//	@Override
//	public Demo get(String entityId) {
//		Demo demo = super.get(entityId);
//		if(demo == null) return null;
//		
//		List<DemoSub> demoSublist = demoSubMananger.getByFk(entityId);
//		demo.setDemoSubList(demoSublist);
//		
//		return demo;
//	}
	
	
	

	/**
	 * URL 表单案例
	 */
//	@Override
//	public void saveDemoJson(ActionCmd actionCmd) {
//		String bizKey = actionCmd.getBusinessKey();
//		JSONObject object = actionCmd.getBusData();
//		Product demo = JSON.toJavaObject(object, Product.class);
//		
//		if(StringUtil.isEmpty(bizKey)) {
//			String id = IdUtil.getSuid();
//			actionCmd.setBusinessKey(id);
//			demo.setId(id);
//			productDao.create(demo);
//			
//			Map<String,Object> hashMap = new HashMap<>();
//			hashMap.put("startVariable", demo.getName());
//			//启动时候设置一些流程变量，请看 act_ru_variable 表、在整个流程声明周期您都可以使用该流程变量，可以用于分支判断等等
//			actionCmd.setActionVariables(hashMap);
//		}else {
//			productDao.update(demo);
//			Map<String,Object> hashMap = new HashMap<>();
//			hashMap.put("doTaskVariable", demo.getName() + "-" + actionCmd.getActionName());
//			actionCmd.setActionVariables(hashMap);
//		}
//	}
	
}
